<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Binh
 * Date: 1/6/14
 * Time: 1:46 PM
 * To change this template use File | Settings | File Templates.
 */
use \Model;

class Controller_Song extends Controller{
    private $view;
    private $path_music;

    public function __construct(){
        $path_music = Uri::base(false)."music/";
        //Cài đặt view
        $this->view = View::forge('home/layout');
        $this->view->head = View::forge('home/head');
        $this->view->header = View::forge('home/header');
        $this->view->footer = View::forge('home/footer');
        $this->view->layout_play_song = View::forge('home/layout_play_song');

        //Cài đặt biến toàn cục
        $this->view->set_global('site', 'layout_play_song');
        $this->view->set_global('path_music', $path_music);
    }

    public function action_play_song($song_id){
        return $this->set_layout($song_id);
    }

    public function set_layout($song_id){
        $play_song = \Model\Song::get_id($song_id);
        $this->view->set_global('play_song', $play_song);
        $this->view->set_global('songs', \Model\Song::get_singer_id($play_song['SINGER_ID']));
        return $this->view;
    }
}